<<<<<<< HEAD
package com.wwx.service.impl;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.wwx.dao.CartoonDao;
import com.wwx.dao.impl.CartoonDaoImpl;
import com.wwx.entity.CartoonDO;
import com.wwx.service.CartoonService;
import com.wwx.util.DBHelper;

public class CartoonServiceImpl implements CartoonService{
	
	private CartoonDao dao=new CartoonDaoImpl();
	@Override
	public List<CartoonDO> getSelectByKey(String key, String value) {
		Connection conn=DBHelper.getConnection();
		List<CartoonDO> list=null;
		try {
			conn.setAutoCommit(false);
			list=dao.getSelectByKey(key, value, conn);
			conn.commit();
		} catch (Exception e) {
			e.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}finally{
			DBHelper.closeConnection(conn);
		}
		return list;
	}
	@Override
	public boolean innertCartoon(CartoonDO cart) {
		// TODO Auto-generated method stub
		Connection conn=DBHelper.getConnection();
		try {
			conn.setAutoCommit(false);
			boolean isBos=dao.innertCartoon(cart, conn);
			conn.commit();
			if(isBos){
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}
		return false;
	}
	@Override
	public List<CartoonDO> selectAllCartoon() {
		Connection conn=DBHelper.getConnection();
		List<CartoonDO> list=null;
		try {
			conn.setAutoCommit(false);
			list=dao.selectAllCartoon(conn);
			conn.commit();
		} catch (Exception e) {
			e.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}
		return list;
	}
	@Override
	public List<CartoonDO> selectAllCartoonPage(CartoonDO cartoonDO, int start, int length) {
		return dao.selectAllCartoonPage(cartoonDO, start, length);
	}
	@Override
	public Integer selectAllCartoonPageNumber(CartoonDO cartoonDO) {
		return dao.selectAllCartoonPageNumber(cartoonDO);
	}
	
}
=======
package com.wwx.service.impl;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.wwx.dao.CartoonDao;
import com.wwx.dao.impl.CartoonDaoImpl;
import com.wwx.entity.CartoonDO;
import com.wwx.service.CartoonService;
import com.wwx.util.DBHelper;

public class CartoonServiceImpl implements CartoonService{
	
	private CartoonDao dao=new CartoonDaoImpl();
	@Override
	public List<CartoonDO> getSelectByKey(String key, String value) {
		Connection conn=DBHelper.getConnection();
		List<CartoonDO> list=null;
		try {
			conn.setAutoCommit(false);
			list=dao.getSelectByKey(key, value, conn);
			conn.commit();
		} catch (Exception e) {
			e.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}finally{
			DBHelper.closeConnection(conn);
		}
		return list;
	}
	@Override
	public boolean innertCartoon(CartoonDO cart) {
		// TODO Auto-generated method stub
		Connection conn=DBHelper.getConnection();
		try {
			conn.setAutoCommit(false);
			boolean isBos=dao.innertCartoon(cart, conn);
			conn.commit();
			if(isBos){
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}
		return false;
	}
	@Override
	public List<CartoonDO> selectAllCartoon() {
		Connection conn=DBHelper.getConnection();
		List<CartoonDO> list=null;
		try {
			conn.setAutoCommit(false);
			list=dao.selectAllCartoon(conn);
			conn.commit();
		} catch (Exception e) {
			e.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}
		return list;
	}
	@Override
	public List<CartoonDO> selectAllCartoonPage(CartoonDO cartoonDO, int start, int length) {
		return dao.selectAllCartoonPage(cartoonDO, start, length);
	}
	@Override
	public Integer selectAllCartoonPageNumber(CartoonDO cartoonDO) {
		return dao.selectAllCartoonPageNumber(cartoonDO);
	}
	
}
>>>>>>> dev
